package thread;

import com.lmax.disruptor.RingBuffer;

import bean.Order;

public class Product {

	 private  RingBuffer<Order> ringBuffer;
	    public  Product(RingBuffer<Order> ringBuffer){
	        this.ringBuffer = ringBuffer;
	    }
	    public void onData(String data){
	        long sequence = ringBuffer.next();
	        try {
	            Order order = ringBuffer.get(sequence);
	            order.setId(data);
	        } finally {
	            ringBuffer.publish(sequence);
	        }
	    }
}
